<?php $baseUrl=Zend_Controller_Front::getInstance()->getBaseUrl(); ?>
<link rel="stylesheet" rev="stylesheet" href="<?php  echo $baseUrl; ?>/css/commoncart.css" type="text/css" media="all" />
<div class="border">
    <div class="content">
        <div>
            <h4 class="header">Thông tin chi tiết đơn hàng</h4>
        </div>
        <div class="clear"></div>
        <?php
        if(isset($this->orderInfo))
        {
        ?>
        <div id="order">
            <h3>
                ĐƠN ĐẶT HÀNG<br/>
                MÃ ĐƠN HÀNG: MDH<?php echo $this->orderInfo["code_order"] ?>
            </h3>
            <div class="clear"></div>
            <div id="user_info">
                <table >
                    <thead>
                        <td colspan="2">
                            <h4 style="text-decoration: underline;">Thông tin người mua</h4>
                        </td>
                    </thead>
                    <tr>
                        <td class="title">
                            Họ và tên:
                        </td>
                        <td>
                            <?php echo $this->orderInfo["user_info"]["lastname"].' '.$this->orderInfo["user_info"]["firstname"];?>
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Giới tính:
                        </td>
                        <td>
                            <?php echo $this->orderInfo["user_info"]["sex"];?>
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Điện thoại:
                        </td>
                        <td>
                            <?php echo $this->orderInfo["user_info"]["phone"];?>
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Email:
                        </td>
                        <td>
                            <?php echo $this->orderInfo["user_info"]["email"];?>
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Địa chỉ:
                        </td>
                        <td>
                            <?php
                            if(isset($this->orderInfo["user_info"]["address"]))
                                echo $this->orderInfo["user_info"]["address"];
                            ?>
                        </td>
                    </tr>
                </table>
                <?php
                if(isset($this->orderInfo["user_info_receive"]))
                {
                ?>
                <table >
                    <thead>
                        <td colspan="2">
                            <h4 style="text-decoration: underline;">Thông tin người nhận</h4>
                        </td>
                    </thead>
                    <tr>
                        <td class="title">
                            Họ và tên:
                        </td>
                        <td>
                            <?php echo $this->orderInfo["user_info_receive"]["lastname"].' '.$this->orderInfo["user_info_receive"]["firstname"];?>
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Giới tính:
                        </td>
                        <td>
                            <?php echo $this->orderInfo["user_info_receive"]["sex"];?>
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Điện thoại:
                        </td>
                        <td>
                            <?php echo $this->orderInfo["user_info_receive"]["phone"];?>
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Email:
                        </td>
                        <td>
                            <?php echo $this->orderInfo["user_info"]["email"];?>
                        </td>
                    </tr>
                    <tr>
                        <td class="title">
                            Địa chỉ:
                        </td>
                        <td>
                            <?php echo $this->orderInfo["user_info_receive"]["address"];?>
                        </td>
                    </tr>
                </table>
                <?php
                }
                ?>
            </div>
            <div class="clear"></div>
            <div id="inforBook">
                <table style="margin-left:80px;" width="90%" cellspacing="0" cellpadding="3">
                    <thead>
                        <td>
                            STT
                        </td>
                        <td>
                            Tên sách
                        </td>
                        <td>
                            Tác giả
                        </td>
                        <td>
                            Số lượng
                        </td>
                        <td>
                            Giá bán
                        </td>
                        <td>
                            Thành tiền
                        </td>
                    </thead>
                         <?php
                            $count=1;
                            $sumMoney=0;
                            $arrBook=$this->orderInfo;
                            foreach($arrBook["book"] as $abook)
                            {
                         ?>
                         <tr>
                         <td>
                            <?php echo $count++; ?>
                         </td>
                         <td>
                            <?php echo $abook["name"];?>
                         </td>
                         <td>
                             <?php echo $abook["authorname"]; ?>
                         </td>
                         <td>
                             <?php echo $abook["number"]; ?>
                         </td>
                         <td>
                              <?php
                                 echo "<span class='price'>".$abook["cost"]." đ</span>";
                              ?>
                         </td>
                         <td>
                             <?php
                                 echo "<span class='price'>".$abook["number"]*$abook["cost"]." đ</span>";
                                 $sumMoney+=$abook["number"]*$abook["cost"];
                              ?>
                         </td>
                         </tr>
                         <?php
                            }
                        ?>
                </table>
                <div class="clear"></div>
                <div style="float:right; margin-right: 20px;">
                    Tổng cộng :
                    <?php

                        echo "<span class='price'>".$sumMoney." đ</span>";
                        echo "<br/><br/><span>Ngày đặt mua:".$this->orderInfo["date_order"]."</span>";
                    ?>
                </div>
            </div>
        </div>
        <?php
        }
        ?>
        <div class="clear"></div>
    </div>
</div>